// src/components/ConnectWallet.tsx
import { useTokenContract } from '../hooks/TokenContractProvider';

export function ConnectWallet() {
  const { account,connectWallet  } = useTokenContract();
  return (
    <div className="wallet-info">
      {account ? (
        <p>已连接: {`${account.slice(0, 6)}...${account.slice(-4)}`}</p>
      ) : (
        <button 
          className="connect-wallet-button"
          onClick={connectWallet}
        >
          连接MetaMask
        </button>
      )}
    </div>
  );
}